﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AncientEmpires_025_132
{
    public class NationSetup
    {
        public enum TypeUpdate
        { 
            UpdatePlayer,
            UpdateTeam
        }
        public enum Navigate
        {
            Next,
            Back
        }
        TypeNation _typeNationSetup;

        public TypeNation TypeNationSetup
        {
            get { return _typeNationSetup; }
            set { _typeNationSetup = value; }
        }
        TeamName _TeamNameSetup;

        public TeamName TeamNameSetup
        {
            get { return _TeamNameSetup; }
            set { _TeamNameSetup = value; }
        }

        NationName _nationNameNationSetup;

        public NationName NationNameNationSetup
        {
            get { return _nationNameNationSetup; }
            set { _nationNameNationSetup = value; }
        }

        public NationSetup()
        { 
        }

        public NationSetup(int i)
        {
            switch (i)
            { 
                case 0:
                    TypeNationSetup = TypeNation.Player;
                    TeamNameSetup = TeamName.Team1;
                    NationNameNationSetup = NationName.Red;
                    break;
                case 1:
                    TypeNationSetup = TypeNation.Player;
                    TeamNameSetup = TeamName.Team2;
                    NationNameNationSetup = NationName.Green;
                    break;
                case 2:
                    TypeNationSetup = TypeNation.Player;
                    TeamNameSetup = TeamName.Team3;
                    NationNameNationSetup = NationName.Blue;
                    break;
                case 3:
                    TypeNationSetup = TypeNation.Player;
                    TeamNameSetup = TeamName.Team4;
                    NationNameNationSetup = NationName.Black;
                    break;
            }
        }

        public void Update(TypeUpdate typeUpdate, Navigate nav)
        {
            switch (typeUpdate)
            { 
                case TypeUpdate.UpdatePlayer:
                    switch (TypeNationSetup)
                    { 
                        case TypeNation.Player:
                            if (nav == Navigate.Next) TypeNationSetup = TypeNation.Computer;
                            else TypeNationSetup = TypeNation.None;
                            break;
                        case TypeNation.Computer:
                            if (nav == Navigate.Next) TypeNationSetup = TypeNation.None;
                            else TypeNationSetup = TypeNation.Player;
                            break;
                        case TypeNation.None:
                            if (nav == Navigate.Next) TypeNationSetup = TypeNation.Player;
                            else TypeNationSetup = TypeNation.Computer;
                            break;
                    }
                    /*
                    if (TypeNationSetup == TypeNation.Player) 
                        TypeNationSetup = TypeNation.Computer;
                    else TypeNationSetup = TypeNation.Player;*/
                    break;
                case TypeUpdate.UpdateTeam:
                    switch (TeamNameSetup)
                    { 
                        case TeamName.Team1:
                            if (nav == Navigate.Next) TeamNameSetup = TeamName.Team2;
                            else TeamNameSetup = TeamName.Team4;
                            break;
                        case TeamName.Team2:
                            if (nav == Navigate.Next) TeamNameSetup = TeamName.Team3;
                            else TeamNameSetup = TeamName.Team1;
                            break;
                        case TeamName.Team3:
                            if (nav == Navigate.Next) TeamNameSetup = TeamName.Team4;
                            else TeamNameSetup = TeamName.Team2;
                            break;
                        case TeamName.Team4:
                            if (nav == Navigate.Next) TeamNameSetup = TeamName.Team1;
                            else TeamNameSetup = TeamName.Team3;
                            break;
                    }
                    break;
            }
        }
    }
}
